/**
 *  Exprezoo Records
 *  Copyright (C) 2012 Sergio De Mattia
 *  
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *  
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *  
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *  
 */
package com.sdmdev.android.exprezoorecords.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

import com.sdmdev.android.exprezoorecords.R;
import com.sdmdev.android.exprezoorecords.json.activity.ArtistsActivity;
import com.sdmdev.android.exprezoorecords.json.activity.EventsActivity;
import com.sdmdev.android.exprezoorecords.json.activity.SongsListActivity;


public class HomePageActivity extends Activity {

	@Override
	public void onCreate(Bundle savedInstanceState) {
    	
    	super.onCreate(savedInstanceState);
        setContentView(R.layout.homepage);
        
        Button btn1 = (Button) findViewById(R.id.button1);
         
         btn1.setOnClickListener(new OnClickListener() {
 			

 			public void onClick(View v) {
 				// TODO Auto-generated method stub
 				Intent intentHome = new Intent(getApplicationContext(), SongsListActivity.class);
 				startActivity(intentHome);
 			}
 		});

         
         
         Button btn2 = (Button) findViewById(R.id.button2);
          
          btn2.setOnClickListener(new OnClickListener() {
  			

  			public void onClick(View v) {
  				// TODO Auto-generated method stub
  				Intent intentContactUs = new Intent(getApplicationContext(), AboutUsActivity.class);
  				startActivity(intentContactUs);
  			}
  		});

          
          
          Button btn3 = (Button) findViewById(R.id.button3);
           
           btn3.setOnClickListener(new OnClickListener() {
   			

   			public void onClick(View v) {
   				// TODO Auto-generated method stub
   				Intent intentEvents = new Intent(getApplicationContext(), EventsActivity.class);
   				startActivity(intentEvents);
   			}
   		});

        
        
       Button btn4 = (Button) findViewById(R.id.button4);
        
        btn4.setOnClickListener(new OnClickListener() {
			

			public void onClick(View v) {
				// TODO Auto-generated method stub
				Intent intentArtists = new Intent(getApplicationContext(), ArtistsActivity.class);
				startActivity(intentArtists);
			}
		});
    	
    }
	
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case R.id.itemExit:
			finish();
			return true;
			
		case R.id.itemInfo:
			startActivity(new Intent(HomePageActivity.this, InfoActivity.class));
			return true;
		default:
			return false;
		}
		
	}
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		MenuInflater inflater = getMenuInflater();
		inflater.inflate(R.menu.home_menu, menu);
		return true;
	}
    
	
	@Override
	protected void onStop() {
		// TODO Auto-generated method stub
		super.onStop();
		finish();
	}
	
	
}